﻿using System.Collections.Generic;

namespace HQS.TokenInterpolation
{
    public class Result : ParserResult<string>
    {
        public Result(Dictionary<string, TokenRuntimeValue> tokenAndValues, string result) : base(result)
        {
            TokenAndValues = tokenAndValues;
            if (TokenAndValues != null)
            {
                foreach (var kvp in TokenAndValues)
                {
                    if (string.IsNullOrWhiteSpace(kvp.Value.ErrorMessage) == false)
                    {
                        AddErrorMessage(kvp.Value.ErrorMessage);
                    }
                }
            }
        }

        public IEnumerable<KeyValuePair<string, TokenRuntimeValue>> TokenAndValues { get; private set; }
    }
}